﻿using System;
using System.Windows;
using FirstFloor.ModernUI.Windows.Controls;

namespace Tisbi.LawFirm.BL
{
    public static class Notifyer
    {
        public static NLog.Logger Instance { get; private set; }

        static Notifyer()
        {
            NLog.LogManager.ReconfigExistingLoggers();

            Instance = NLog.LogManager.GetCurrentClassLogger();
        }

        public static void LogError(Exception exception, string message = "")
        {
            Instance.ErrorException(message, exception);
        }

        public static void NotifyError(string message, Exception error)
        {
            // Notify view of an error
            ModernDialog.ShowMessage(string.Format(message), "Ошибка", MessageBoxButton.OK);
            LogError(error, message);
        }

        public static void Notify(string message)
        {
            // Notify view of an error
            ModernDialog.ShowMessage(message, "Сообщение", MessageBoxButton.OK);
        }

        public static void NotifyWithActino(string message, Action callBackAction)
        {
            Notify(message);
            callBackAction();
        }
    }
}
